using UnityEngine;
using System.Collections;

public class Recarregar : MonoBehaviour {

    private GameObject canhao;
    private Launcher launcher;
    private float tempo;

	// Use this for initialization
	void Start () {

       canhao = GameObject.Find("Canhao/Launcher");
       launcher = canhao.GetComponent<Launcher>();
       tempo = launcher.t_recarga;
	}
	
	// Update is called once per frame
	void Update () {

        if (launcher.n_tiro < 5 && !this.IsInvoking("Reload"))
        {
            Invoke("Reload", tempo);
        }
	}

    public void Reload()
    {
        launcher.n_tiro++;
    }
}
